package application.common.ui.controller;

import java.net.URL;
import java.util.ResourceBundle;


import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.concurrent.Service;
import javafx.concurrent.Task;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
public class LoadingController implements Initializable {

	@FXML
	private ProgressBar progressBar;
	
	@FXML
	private Label messageLabel;
	
	private StringProperty message = new SimpleStringProperty();
	public LoadingController(String message) {
		this.message.set(message);
	}

	public void initialize(URL arg0, ResourceBundle arg1) {
		messageLabel.setText(message.get());
		Service<Integer> service = new Service<Integer>() {
			@Override
			protected Task<Integer> createTask() {
				return new Task<Integer>() {
					@Override
					protected Integer call() throws Exception {
						return null;
					};
				};
			}
		};
		progressBar.progressProperty().bind(service.progressProperty());
		service.start();
	}
}
